package com.printersystem.ssm.controller;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import com.printersystem.ssm.entities.User;
import com.printersystem.ssm.services.impl.UserServiceImpl;

@Controller
@RequestMapping("/user")
public class UserController {
	@Resource(name="userService")
	private UserServiceImpl userService;
	
	@RequestMapping("/add")
	public ModelAndView add(User user) {
		ModelAndView mv = new ModelAndView();
		int result = userService.addUser(user);
		System.out.println(result);
		mv.addObject("result",result);
		mv.setViewName("/success");
		return mv;
	}
	
}
